﻿'Como fazíamos antes do VB 10 / Collection Initializers

Module Program_Antes
    Sub Main()
        Mostrar_Array()
        Console.WriteLine("-----")

        Mostrar_List()
        Console.WriteLine("-----")

        Mostrar_Dictionary()
        Console.WriteLine("-----")
    End Sub

#Region "Array"

    Sub Mostrar_Array()
        Dim valores As Integer() = {10, 13, 17, 19}

        For Each v In valores
            Console.WriteLine("Valor: {0}", v)
        Next
    End Sub

#End Region

#Region "List"

    Sub Mostrar_List()
        Dim listaDeNomes = New List(Of String)()
        listaDeNomes.Add("Carlos")
        listaDeNomes.Add("Rita")
        listaDeNomes.Add("Marcos")
        listaDeNomes.Add("Joana")

        For Each n In listaDeNomes
            Console.WriteLine("Nome: {0}", n)
        Next
    End Sub

#End Region

#Region "Dictionary"

    Sub Mostrar_Dictionary()
        Dim dicionarioDeNomes = New Dictionary(Of Integer, String)()
        dicionarioDeNomes.Add(1, "Filipe")
        dicionarioDeNomes.Add(2, "José")

        For Each e In dicionarioDeNomes
            Console.WriteLine("Id: {0}, Nome: {1}", e.Key, e.Value)
        Next
    End Sub

#End Region

End Module
